package server

import (
	"example/helloworld/api"
	"example/helloworld/internal/service"
	"github.com/gin-gonic/gin"
)

type Server struct {
	router *gin.Engine
}

func NewServer() *Server {
	router := gin.New()
	svc := service.NewService()
	api.NewHelloWorldGinHandler(svc.HelloWorld).RegisterRouter(router)
	return &Server{
		router: router,
	}
}

func (s *Server) Run() {
	s.router.Run(":8080")
}

func (s *Server) initRouter() *gin.Engine {
	router := gin.New()
	s.helloHandler.RegisterRouter(router)
	return router
}
